#pragma once
#include <d3d9.h>

typedef struct BitmapStruct
{
	HBITMAP hBitmap;                 //Cached bitmap (DIB section) in RAM for reloading
	IDirect3DSurface9* pSurface;     //The surface, could be NULL if not asked to draw yet
	IDirect3DDevice9* pDevice;       //The D3D device the surface was made for
	long WidthPix;
	long HeightPix;
	BitmapStruct() : hBitmap(NULL), pSurface(NULL), pDevice(NULL){};
} BitmapStruct;

typedef class C2DGraphics
{
public:

	C2DGraphics();
	~C2DGraphics();

	int Initialize();
	int LoadBitmapFromFile(const WCHAR *Filename, BitmapStruct *pBitmap);
	int DrawBitmap(IDirect3DDevice9 *pDevice, BitmapStruct *pBitmap, long ScreenX, long ScreenY);
	int DeleteBitmap(BitmapStruct *pBitmap);
	int Shutdown();

protected:
	
	int ReloadSurface(BitmapStruct *pBitmap, IDirect3DDevice9 *pDevice);

} C2DGraphics;

